package com.ai.file;

/**
 * @author: heJinQin
 * @create: 2024-02-26 22:47
 * @description:
 **/

public class RobotT {
    public static void main(String[] args) {
        String originalText = "This is a openai OPENAI chatGPTchatgpt CHATGPT3.0and GPTGpt example.";
        String modifiedText =
                originalText
                        .replaceAll("(?i)chatgpt", "***")
                        .replaceAll("(?i)OPENAI", "***").
                        replaceAll("(?i)gpt", "***");
        System.out.println(modifiedText);
        String text = "你是gpt吗,chatGpt很好用,我不是Gpt-4";
        // 正则表达式，用于匹配"chatgpt"或"gpt"(不区分大小写)
        String regex = "(?i)(chatgpt|gpt|openai)"; // 检查字符串是否匹配
        boolean containsSensitiveWords = text.matches(".*" + regex + ".*");
        System.out.println("Contains sensitive words: " + containsSensitiveWords);
    }

 }
